<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>xiarikui管理后台</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link href="/Public/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="/Public/bootstrap/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link href="/Public/dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
    <link href="/Public/dist/css/skins/_all-skins.min.css" rel="stylesheet" type="text/css" />
    <link href="/Public/plugins/iCheck/flat/blue.css" rel="stylesheet" type="text/css" />
    <link href="/Public/Admin/css/unify.css" rel="stylesheet" type="text/css" />
    <link rel="shortcut icon" href="/Public/images/favicon.ico" type="image/x-icon" />
    <script src="/Public/js/jQuery-2.1.4.min.js"></script>
    <script src="/Public/js/global.js"></script>
    <script src="/Public/js/myFormValidate.js"></script>
    <script src="/Public/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="/Public/js/layer/layer-min.js"></script>
    <script src="/Public/js/myAjax.js"></script>
    <script type="text/javascript">
    function delfunc(obj) {
        layer.confirm('确认删除？', {
            btn: ['确定', '取消']
        }, function() {
            $.ajax({
                type: 'post',
                url: $(obj).attr('data-url'),
                data: {
                    act: 'del',
                    del_id: $(obj).attr('data-id')
                },
                dataType: 'json',
                success: function(data) {
                    if (data == 1) {
                        layer.msg('操作成功', {
                            icon: 1
                        });
                        $(obj).parent().parent().remove();
                    } else {
                        layer.msg(data, {
                            icon: 2,
                            time: 2000
                        });
                    }
                    layer.closeAll();
                }
            });
        }, function(index) {
            layer.close(index);
            return false;
        });
    }

    //全选
    function selectAll(name, obj) {
        $('input[name*=' + name + ']').prop('checked', $(obj).checked);
    }

    function get_help(obj) {
        layer.open({
            type: 2,
            title: '',
            shadeClose: true,
            shade: 0.3,
            area: ['90%', '90%'],
            content: $(obj).attr('data-url')
        });
    }

    function delAll(obj, name) {
        var a = [];
        $('input[name*=' + name + ']').each(function(i, o) {
            if ($(o).is(':checked')) {
                a.push($(o).val());
            }
        });
        if (a.length == 0) {
            layer.alert('请选择删除项', {
                icon: 2
            });
            return;
        }
        layer.confirm('确认删除？', {
            btn: ['确定', '取消']
        }, function() {
            $.ajax({
                type: 'get',
                url: $(obj).attr('data-url'),
                data: {
                    act: 'del',
                    del_id: a
                },
                dataType: 'json',
                success: function(data) {
                    if (data == 1) {
                        layer.msg('操作成功', {
                            icon: 1
                        });
                        $('input[name*=' + name + ']').each(function(i, o) {
                            if ($(o).is(':checked')) {
                                $(o).parent().parent().remove();
                            }
                        });
                    } else {
                        layer.msg(data, {
                            icon: 2,
                            time: 2000
                        });
                    }
                    layer.closeAll();
                }
            });
        }, function(index) {
            layer.close(index);
            return false;
        });
    }
    </script>
    <style type="text/css">
        .table > thead:first-child > tr:first-child > th{
            border-bottom: 0 none;
        } 
    </style>
</head>

<body>

<script type="text/javascript">
    window.UEDITOR_Admin_URL = "/Public/plugins/Ueditor/";
    var URL_upload = "<?php echo ($URL_upload); ?>";
    var URL_fileUp = "<?php echo ($URL_fileUp); ?>";
    var URL_scrawlUp = "<?php echo ($URL_scrawlUp); ?>";
    var URL_getRemoteImage = "<?php echo ($URL_getRemoteImage); ?>";
    var URL_imageManager = "<?php echo ($URL_imageManager); ?>";
    var URL_imageUp = "<?php echo ($URL_imageUp); ?>";
    var URL_getMovie = "<?php echo ($URL_getMovie); ?>";
    var URL_home = "<?php echo ($URL_home); ?>";
</script>
<script type="text/javascript" src="/Public/plugins/Ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/Public/plugins/Ueditor/ueditor.all.js"></script>
<link href="/Public/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="/Public/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="/Public/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<div class="wrapper">
    <div class="breadcrumbs" id="breadcrumbs">
    <ol class="breadcrumb">
        <?php if(is_array($navigate_admin)): foreach($navigate_admin as $k=>$v): ?><li><?php echo ($k); ?></li><?php endforeach; endif; ?>
    </ol>
</div>

    <section class="content">
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default pull-right" data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i>问题信息</h3>
                </div>
                <div class="panel-body">
                    <form action="<?php echo U('qa/handle');?>" method="post" >
                        <table class="table table-bordered">
                            <tbody>
                                <tr>
                                    <td class="col-sm-1 text-right">标题:</td>
                                    <td>
                                        <input type="text" class="form-control" name="info[title]" value="<?php echo ($info["title"]); ?>">
                                    </td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <td class="col-sm-1 text-right">标题补充:</td>
                                    <td>
                                        <textarea  class="form-control" name="info[desc]"><?php echo ($info["desc"]); ?></textarea>
                                    </td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <td class="col-sm-1 text-right">提问者:</td>
                                    <td>
                                        <select name="info[user_id]" class="form-control" >
                                            <?php if(is_array($users)): $i = 0; $__LIST__ = $users;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo["user_id"]); ?>" <?php if($vo[user_id] == $info[user_id]): ?>selected<?php endif; ?>><?php echo ($vo["username"]); ?>[<?php echo ($vo["mobile"]); ?>]</option><?php endforeach; endif; else: echo "" ;endif; ?>
                                        </select>
                                    </td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <td class="col-sm-1 text-right">专业类型:</td>
                                    <td>
                                        <select name="info[cat_ids][]" class="form-control" multiple >
                                            <option value="">请选择</option>
                                            <?php if(is_array($cat_ids)): $i = 0; $__LIST__ = $cat_ids;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($key); ?>" <?php if(in_array(($key), is_array($info["cat_ids"])?$info["cat_ids"]:explode(',',$info["cat_ids"]))): ?>selected<?php endif; ?> ><?php echo ($vo); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                                        </select>
                                    </td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <td class="col-sm-1 text-right">截止时间:</td>
                                    <td>
                                        <input type="text" class="form-control" id="stop_time"  name="info[stop_time]" value="<?php echo (date('Y-m-d H:i:s',$info["stop_time"])); ?>">
                                    </td>
                                    <td></td>
                                </tr>


                                <tr>
                                <td class = "text-right">是否开启悬赏:</td>
                                <td>
                            <input name="info[open_reward]" type="radio" value="1" <?php if($info['open_reward'] == 1): ?>checked<?php endif; ?> >是
                            <input name="info[open_reward]" type="radio" value="0" <?php if($info['open_reward'] == 0): ?>checked<?php endif; ?> >否
                            </td>
                            <td></td>
                            </tr>

                                <tr>
                                    <td class="col-sm-1 text-right">悬赏金额:</td>
                                    <td>
                                        <input type="text" class="form-control" name="info[reward_money]" value="<?php echo ($info["reward_money"]); ?>">
                                    </td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <td class="col-sm-1 text-right">阅读量:</td>
                                    <td>
                                        <input type="text" class="form-control" name="info[read_num]" value="<?php echo ($info["read_num"]); ?>">
                                    </td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <td class="col-sm-1 text-right">问题状态:</td>
                                    <td>
                                        <select name="info[question_status]" class="form-control" >
                                            <option value="">请选择</option>
                                            <?php if(is_array($q_status)): $i = 0; $__LIST__ = $q_status;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($key); ?>" <?php if($key == $info[question_status]): ?>selected<?php endif; ?> ><?php echo ($vo); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                                        </select>
                                    </td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <td class="col-sm-1 text-right">回答状态:</td>
                                    <td>
                                        <select name="info[answer_status]" class="form-control" >
                                            <option value="">请选择</option>
                                            <?php if(is_array($a_status)): $i = 0; $__LIST__ = $a_status;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($key); ?>" <?php if($key == $info[answer_status]): ?>selected<?php endif; ?> ><?php echo ($vo); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                                        </select>
                                    </td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <td class="col-sm-1 text-right">响应时间秒数:</td>
                                    <td>
                                        <input type="text" class="form-control" name="info[response_sec]" value="<?php echo ($info["response_sec"]); ?>">秒
                                    </td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <td class="col-sm-1 text-right">提问时间:</td>
                                    <td>
                                        <?php echo (date("Y-m-d H:i:s",$info["add_time"])); ?>
                                    </td>
                                    <td></td>
                                </tr>


                            </table>
                            </tr>

                            </tbody>
                        </table>

                        <?php if(!empty($has_answer)): ?><h3>回答信息：</h3>
                            <table class="table table-bordered">
                                <tbody>
                                <tr>
                                    <td class="col-sm-1 text-right">会计师名称:</td>
                                    <td>
                                        <?php echo ($has_answer["username"]); ?>
                                    </td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <td class="col-sm-1 text-right">会计师手机:</td>
                                    <td>
                                        <?php echo ($has_answer["mobile"]); ?>
                                    </td>
                                    <td></td>
                                </tr>



                                <tr>
                                    <td class = "text-right">是否付费查看:</td>
                                    <td>
                                        <input name="has_answer[charge_view]" type="radio" value="1" <?php if($has_answer['charge_view'] == 1): ?>checked<?php endif; ?> >是
                                        <input name="has_answer[charge_view]" type="radio" value="0" <?php if($has_answer['charge_view'] == 0): ?>checked<?php endif; ?> >否
                                    </td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <td class="col-sm-1 text-right">付费金额:</td>
                                    <td>
                                        <input type="text" class="form-control" name="has_answer[charge_money]" value="<?php echo ($has_answer["charge_money"]); ?>">
                                    </td>
                                    <td></td>
                                </tr>


                                <tr>
                                    <td class="col-sm-1 text-right">付费查看用户数量:</td>
                                    <td>
                                        <?php echo ($has_answer["count"]); ?>
                                    </td>
                                    <td></td>
                                </tr>


                                <tr>
                                    <td class="col-sm-1 text-right">回复内容:</td>
                                    <td>
                                        <textarea  class="form-control" name="has_answer[content]"><?php echo ($has_answer["content"]); ?></textarea>
                                    </td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <td class="col-sm-1 text-right">回答时间:</td>
                                    <td>
                                        <input type="text" class="form-control" id="add_time"  name="has_answer[add_time]" value="<?php echo (date('Y-m-d H:i:s',$has_answer["add_time"])); ?>">
                                    </td>
                                    <td></td>
                                </tr>


                                <tr>
                                    <td></td>
                                    <td>
                                        <input type="hidden" value="<?php echo ($info["id"]); ?>" name="info[id]" />
                                        <input type="hidden" value="<?php echo ($has_answer["id"]); ?>" name="has_answer[id]" />
                                        <input type="hidden" value="<?php echo ($act); ?>" name="act" />
                                        <button type="submit" class="btn btn-info">
                                            <i class="ace-icon fa fa-check bigger-110"></i> 保存
                                        </button>
                                    </td>
                                </tr>

                            </table><?php endif; ?>

                        <?php if(!empty($no_answer)): ?><h3>尚未回答：</h3>
                            <table class="table table-bordered">
                                <tbody>
                                <tr>
                                    <td class="col-sm-1 text-right">会计师列表:</td>
                                    <td>
                                        <select name="no_answer[au_id]" class="form-control" >
                                            <option value="0">请选择</option>
                                            <?php if(is_array($account_users)): $i = 0; $__LIST__ = $account_users;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo["au_id"]); ?>"  <?php if($vo[au_id] == $no_answer[answer_id]): ?>selected<?php endif; ?>><?php echo ($vo["username"]); ?>[<?php echo ($vo["mobile"]); ?>]</option><?php endforeach; endif; else: echo "" ;endif; ?>
                                        </select>
                                    </td>
                                    <td>可以更改需要回答此问题的会计师</td>
                                </tr>

                                <tr>
                                    <td></td>
                                    <td>
                                        <input type="hidden" value="<?php echo ($info["id"]); ?>" name="info[id]" />
                                        <input type="hidden" value="<?php echo ($no_answer["id"]); ?>" name="no_answer[id]" />
                                        <input type="hidden" value="<?php echo ($act); ?>" name="act" />
                                        <button type="submit" class="btn btn-info">
                                            <i class="ace-icon fa fa-check bigger-110"></i> 保存
                                        </button>
                                    </td>
                                </tr>

                                </tbody>
                            </table><?php endif; ?>
                    </form>
                </div>
            </div>
        </div>
    </section>
</div>
<script>
    $(document).ready(function () {
        $('#stop_time,#add_time').daterangepicker({
            format : 'YYYY-MM-DD HH:mm',
            singleDatePicker: true,
            showDropdowns: true,
            timePicker : true,
            timePicker12Hour : false,
            timePickerIncrement : 1, //时间的增量，单位为分钟
            minDate: '2017/08/01',
            maxDate: '2030/01/01',
            locale: {
                applyLabel: '确定',
                cancelLabel: '取消',
                fromLabel: '起始时间',
                toLabel: '结束时间',
                customRangeLabel: '自定义',
                daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
                firstDay: 1
            }
        });
    });

</script>
</body>

</html>